import 'package:flutter/material.dart';
import 'package:jiajia_diy/pages/home_page.dart';
import 'dart:async';

/*
app闪屏首页
 */
class Landing extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => new LandingState();
}

class LandingState extends State<Landing> {
  bool _isJump = false;

  @override
  Widget build(BuildContext context) {
    return new Material(
      child: new InkWell(
        onTap: () {
          goToHomePage();
        },
        child: new Column(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: <Widget>[
            new Expanded(
              flex: 4,
              child: new Container(
                 alignment: Alignment(0.0,-0.3),
                child: new Text(
                  '壹個工作室',
                  style: new TextStyle(
                      fontSize: 38.0,
                      fontWeight: FontWeight.bold,
                      color: Color(0xFF5167a6)),
                ),
              ),
            ),
            new Expanded(
              child: new Text(
                '南京尤绮佳文化传播有限公司',
                style:
                    new TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold),
              ),
            ),
          ],
        ),
      ),
    );
  }

  //初始的时候开始倒计时
  @override
  void initState() {
    super.initState();
    countDown();
  }

  //倒计时方法
  void countDown() {
    var _duration = new Duration(seconds: 1);
    new Future.delayed(_duration, goToHomePage);
  }

  FutureOr goToHomePage() {
    Navigator.of(context).pushReplacementNamed('/HomePage');
  }
}
